Skip to content

feat: use 1 minute window for searches#2019

Merged
kodiakhq[bot] merged 4 commits intomainfrom
aaron/default-search-smaller-window
Apr 2, 2026
Merged

feat: use 1 minute window for searches#2019
kodiakhq[bot] merged 4 commits intomainfrom
aaron/default-search-smaller-window

Conversation

@knudtty
Copy link
Copy Markdown
Contributor

@knudtty knudtty commented Mar 31, 2026

Summary

This PR changes searches to a 1 minute up front window, rather than a 6h. Also, the refresh time was moved from 4s back to 10s.

How to test locally or on Vercel

  1. Go to preview
  2. Inspect console and check a search query
  3. See search query is searching over 60 seconds

References

Closes HDX-3866

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 31, 2026

🦋 Changeset detected

Latest commit: ba2ab5d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@hyperdx/app Patch
@hyperdx/api Patch
@hyperdx/otel-collector Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@knudtty knudtty requested review from a team and teeohhem and removed request for a team March 31, 2026 14:40
@vercel
Copy link
Copy Markdown

vercel bot commented Mar 31, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hyperdx-oss Ready Ready Preview, Comment Apr 2, 2026 2:33pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

PR Review

  • ⚠️ windowDurationsSeconds not in query key (key) — if enableSmallFirstWindow ever changes dynamically at runtime, the infinite query won't invalidate/refetch, silently using stale window config. Static usage today makes this safe, but it's a latent footgun. Consider adding enableSmallFirstWindow to the query key or documenting the static-only constraint.

  • ⚠️ DEFAULT_TIME_WINDOWS_SECONDS.slice() called on every render without memoization — not a correctness bug, but creates a new array reference each render. The windowDurationsSeconds is passed to meta (which doesn't trigger refetch), so this is harmless today, but useMemo would be safer.

  • ✅ The 15m window prepended to DEFAULT_TIME_WINDOWS_SECONDS is a global default change (affects all callers of this hook), but the test mocks in useChartConfig.test.tsx correctly isolate existing tests from this change.

  • ✅ No security issues or critical bugs found. Logic for prepending ONE_MIN_WINDOW and plumbing windowDurationsSeconds through getNextPageParam/queryFn is correct.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 31, 2026

E2E Test Results

All tests passed • 128 passed • 3 skipped • 1015s

Status Count
✅ Passed 128
❌ Failed 0
⚠️ Flaky 0
⏭️ Skipped 3

Tests ran across 4 shards in parallel.

View full report →

Comment on lines +22 to +45
jest.mock('@/utils/searchWindows', () => {
const original = jest.requireActual('@/utils/searchWindows');
const mockWindows = [
6 * 60 * 60, // 6h
6 * 60 * 60, // 6h
12 * 60 * 60, // 12h
24 * 60 * 60, // 24h
];
return {
...original,
DEFAULT_TIME_WINDOWS_SECONDS: mockWindows,
generateTimeWindowsDescending: (
startDate: Date,
endDate: Date,
windowDurationsSeconds?: number[],
) =>
original.generateTimeWindowsDescending(
startDate,
endDate,
windowDurationsSeconds ?? mockWindows,
),
};
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may look odd, but it's done in the downstream repo too

@kodiakhq kodiakhq bot merged commit bb24994 into main Apr 2, 2026
16 checks passed
@kodiakhq kodiakhq bot deleted the aaron/default-search-smaller-window branch April 2, 2026 14:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants